﻿using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace Pipeline.Middleware.Common
{
    public class Request
    {
        private readonly List<string> _processHistory;

        public int ProcessTimes { get; private set; }
        public string RequestMessage { get; set; }
        public ReadOnlyCollection<string> ProcessHistory { get { return _processHistory.AsReadOnly(); } }

        public Request()
        {
            _processHistory=new List<string>();
        }

        public void Process(string message,string description)
        {
            RequestMessage = message;
            _processHistory.Add(description);

            ProcessTimes++;
        }
    }

    public class Response
    {
        private readonly List<string> _processHistory;
        public int ProcessTimes { get; private set; }
        public string ResponseMessage { get; set; }
        public ReadOnlyCollection<string> ProcessHistory { get { return _processHistory.AsReadOnly(); } }

        public Response()
        {
            _processHistory=new List<string>();
        }

        public void Process(string message, string description)
        {
            ResponseMessage = message;
            _processHistory.Add(description);

            ProcessTimes++;
        }
    }

    public class Context
    {
        public  Request Request { get;private set; }
        public Response Response { get; private set; }

        public Context(Request request,Response response)
        {
            Request = request;
            Response = response;
        }
    }
}